//
//  EmailValidRequest.swift
//  PokeMaster
//
//  Created by 李腾芳 on 2022/1/12.
//  Copyright © 2022 OneV's Den. All rights reserved.
//

import Foundation
import Combine

struct EmailValidRequest {
    let email: String
    var publisher: AnyPublisher<Bool, Never> {
        Future { promise in
            DispatchQueue.global().asyncAfter(deadline: DispatchTime.now() + 2.0) {
                if email.contains(".com") {
                    promise(.success(true))
                } else {
                    promise(.success(false))
                }
                
            }
        }
        .receive(on: DispatchQueue.main)
        .eraseToAnyPublisher()
    }
}
